<template>
    <div class="loginWrap">
        <input type="text" v-model="name">
        <input type="password" v-model="password">
        <button @click="getInputData">提交</button>
    </div>
</template>
<script>
import {setStore,getStore} from '@/config/mUtils';
export default {

  name: "login",
  data() {
    return {
      name: "",
      password: ""
    };
  },
  methods: {
    getInputData() {
      if (!this.name) {
        alert('请输入您的名字');
        return false;
      }else if(!this.password){
        alert('请输入您的密码');
        return false;
      }
      setStore('Token',this.name);
      console.log( getStore('Token'));
      if (this.$route.query.redirect) {
        //     let redirect = decodeURIComponent(this.$route.query.redirect);
        let redirect = this.$route.query.redirect;
        console.log(redirect);
        this.$router.push(redirect);
      } else {
        this.$router.push("/");
      }
    }
  }
};
</script>
<style scoped lang="scss">
@import "../../style/mixin";
.loginWrap {
  width: 80%;
  margin:0 auto;
  padding:1rem 0;
  background: #ccc000;
}
.loginWrap input{
  display:block;
  width:80%;
  margin:1rem auto;
  height:1rem;

}

.loginWrap button{
  display:block;
  width:80%;
  height:1rem;
  margin:1rem auto;
}
</style>


